<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>动态属性</title>
</head>

<body>
    <h1>动态属性</h1>
    <div style="color: gray;">
        <p>在dom中，不能用attrName方式命名，因为都会转为小写。</p>
        <p>在dom中，不能用attr-name方式命名，因为都会当做表达式 attr - name。</p>
        <p>
            app.attr_name = "title"
        </p>
    </div>
    
    <div>
        <a href="/">回目录</a>
    </div>
    <hr>
    <div id="app">
        <a v-bind:[attr_name]="url">动态属性</a>  
    </div>
    <script src="/node_modules/vue/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el: "#app",
            data: {
                attr_name: "href",
                url: "http://www.baidu.com",
            }
        });
    </script>
</body>

</html>